<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title><!--{$lang.page.index.title}--></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/lay/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/lay/layui/index.css" media="all">
</head>
<body style="background: #fbfbfb;">

  <div class="layui-fluid">
    <div class="layui-card">

      <div class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label"><!--{$lang.page.table.account}--></label>
            <div class="layui-input-inline">
              <input type="text" name="username" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label"><!--{$lang.page.table.phone}--></label>
            <div class="layui-input-inline">
              <input type="text" name="mobile" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label"><!--{$lang.page.table.realname}--></label>
            <div class="layui-input-inline">
              <input type="text" name="realname" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>

            <div class="layui-inline">
              <label class="layui-form-label"><!--{$lang.page.table.type}--></label>
              <div class="layui-input-inline" >
                 <select name="roletype">
                     <option value=""><!--{$lang.page.public.select}--></option>
                   <!--{foreach item=item from=$rolelist}-->
                     <option  value="<!--{$item.id}-->" if><!--{$item.title}--></option>
                   <!--{/foreach}-->
              </select>
              </div>
           </div>

          <div class="layui-inline">
            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="search">
              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
            </button>
          </div>
        </div>
      </div>
    </div>
     
     <div class="layui-card-body" style="padding:0px">
            <div style="padding-bottom: 10px;">
                <button class="layui-btn layuiadmin-btn-admin" id="sontodad"><!--{$lang.page.table.confirm}--></button>
            </div>

            <table id="datalist" lay-filter="datalist"></table>
            <script type="text/html" id="zizeng">{{d.LAY_TABLE_INDEX+1}}</script>
            <script type="text/html" id="bartool"></script>
        </div>

  </div>

</body>
</html>

  <script src="/static/lay/layui/layui.js"></script>
  <script type="text/javascript">
   layui.config({
       base: '/static/lay/' //静态资源所在路径
    }).extend({
        xadmin:'lib/xadmin'
        ,lang: 'lib/lang' //语言
    }).use(['xadmin', 'table','lang'], function () {

            var $ = layui.$
            , form = layui.form
            , table = layui.table;
            var lang=layui.lang.init();
            table.render({
            elem: '#datalist'
            , height: 'auto'
            , url: '#' //数据接口
            , method: 'post'
            , page: true //开启分页
            , limit: 5
            , cols: [[ //表头
                {field: 'id', title: 'ID', align: "center", fixwidth: true, width: 60,
                    templet: function(d) {
                        return '<input lay-skin="primary" type="checkbox" name="useraid" value="'+d.aid+'" >';
                    }
                },
                {field: 'username',  title: function(){ return lang.account }, width: 180},
                {field: 'realname', title: function(){ return lang.realname }},  
                {field: 'type', title: function(){ return lang.type }},
                {field: 'mobile', title: function(){ return lang.phone }}           
            ]],
             done: function() {
                    layer.closeAll('loading');
                }
            });
        //监听搜索
        form.on('submit(search)', function(data){
          var field = data.field;
          //执行重载
           table.reload('datalist', {
            where: field
          });
        });

        $(document).on('click',"#sontodad",function(){
            var Values = [];
            $('input[type=checkbox]:checked').each(function(){
                Values.push($(this).val());
            });
            //调用父页面函数，并把刚刚输入的值传递到子页面
            parent.ppp(Values); 
            //关闭 子页面
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
        
    });
    // 获取父页面参数
    window.child = function(param){
      proid=param;
    }
  </script>